package com.alibaba.otter.node.etl.load.loader.mq.rabbit.strategy;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by lvdelu on 2017/3/20 0020.
 *
 * 官方文档：
 * http://qydev.weixin.qq.com/wiki/index.php?title=%E5%8F%91%E9%80%81%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E
 * http://qydev.weixin.qq.com/wiki/index.php?title=%E6%B6%88%E6%81%AF%E7%B1%BB%E5%9E%8B%E5%8F%8A%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F#text.E6.B6.88.E6.81.AF
 */
//@Slf4j
//public final class QYWXNotifyUtil {
//
//	private QYWXNotifyUtil() {
//	}
//
//	private static String sendUrl = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=";
//	private static String getTokenUrl = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=wx00ec802f42606bb1&corpsecret=04zkSPCisPiHEOOdUt1nFyX5akAD81r4Slf20oocLDMms11H5EpoGNUYWEQAtEX1";
//
//	private static String getToken() {
//		JSONObject result = JSONObject
//				.parseObject(com.hujiang.basic.framework.core.util.HttpClientUtil.sendHttpGet(getTokenUrl));
//		return result != null ? result.getString("access_token") : StringUtils.EMPTY;
//	}
//
//	public static String sendQYWX(String users, String content) {
//
//		if (StringUtils.isEmpty(users) || StringUtils.isEmpty(content)) {
//			log.error("users : {} , content :{} is empty", users, content);
//		}
//
//		String token = getToken();
//		if (StringUtils.isEmpty(token)) {
//			log.error("qywx token is empty");
//		}
//
//		JSONObject params = new JSONObject();
//		JSONObject text = new JSONObject();
//		text.put("content", content);
//
//		params.put("msgtype", "text");
//		params.put("agentid", "9");
//		params.put("safe", "0");
//		params.put("touser", users);
//		params.put("text", text);
//
//		String result = com.hujiang.basic.framework.core.util.HttpClientUtil.sendHttpPost(sendUrl + token,
//				params.toJSONString());
//		log.info("qywx result :{} parameter:{}", result, params.toJSONString());
//		return result;
//
//	}
//}
